<?php
/**
 *  view: messages
 *  File: conversation/messages.php
 */
if( isset($user) )
  //$user_name = ( $user->name!="" )?$user->name:$user->username;
  $user_name = $user->username;
else
  $user_name = "";

if( isset($user_from) )
  //$user_from_name = ( $user_from->name!="" )?$user_from->name:$user_from->username;
  $user_from_name = $user_from->username;
else
  $user_from_name = "";
?>
<input type="hidden" id="user_from_name" value="<?php echo $user_from_name; ?>" />
<div id="f_main">
 	<div class="f_container">
    
    <h3>
      <?php
      if( true == $user_from->is_online)
        echo "<span class='online' title='Online'></span>";
      else
        echo "<span class='offline' title='Offline'></span>";
      ?>
      <?php echo $user_from_name; ?> (<?php if(isset($user_from)) echo $user_from->age; else echo "?"; ?>)
    </h3>
    <div class="block-left">
      
    	<?php if( NULL != $main_from_image ){ ?>
    	<img class="profil" src="<?php echo base_url(); ?>profile/image/small/<?php if(isset($user_from)) echo $user_from->id .'/'. $main_from_image; ?>" alt="<?php echo $user_from_name; ?>" />
        <?php } else { ?>
        <img class="profil" src="<?php echo base_url(); ?>img/no_image.gif" alt="" />
        <?php } ?>
        
        
         <p><img src="<?php echo base_url(); ?>img/template/gallery.png" align="left" width="25" height="20" alt="gallery"><a href="<?php echo base_url(); ?>profile/view_profile_photo/<?php echo $user_from->username ?>.htm"><?php echo lang('view_photo_gallery'); ?></a></p>
        <div class="baloon"></div>
        <div class="about-me">
        <p><span><?php echo lang('flirtyy_profile_text'); ?> </span><?php if(isset($user_from)) echo $user_from->flirt_text; ?></p>
        </div>
    </div><!--end block-left-->
    <div class="block">
    	
        <h4><?php echo lang('my_messages')." ".$user_from_name; ?></h4>
        
        <div class="conversation-block" id='messages_list'>
        <?php  
        
        $this->load->view('conversation/part/messages_list');
        
        ?>
        </div><!-- End message list -->
        <input type='hidden' id="to_id" value="<?php echo $user_from->id; ?>" />
        <textarea class="chat-box" name="" id="message" cols="" rows="" placeholder="<?php echo lang('input_message'); ?>"></textarea>
        <span class="counter"><?php echo lang('number_characters'); ?>: <strong id="num_caracters"><?php echo $this->config->item('message_lenght'); ?></strong></span>
        <br/>
        <span class="counter"><?php echo lang('message_price'); ?>: <strong id="message_price">5</strong> <?php echo lang('coins'); ?></span>
        <input class="save" name="" type="button" id="send_message" value="<?php echo lang('send_message'); ?>"/>
        
        <div id="response"></div>
               
    </div><!--end block-->
    <div class="block-right">
    	<div class="side-module">
        
              <?php $this->load->view('modules/my_favorites'); ?>
          
        </div><!--End side-module-->
        <div class="basic-module">
          
              <?php $this->load->view('modules/whos_viewed_your_profile');  ?>
          
        </div><!--End basic-module-->
        <div class="side-module">
          
              <?php $this->load->view('modules/my_friends');  ?>
          
        </div><!--End side-module-->
    </div><!--end block-right-->
    </div><!--end f_container-->
 </div><!--end f_main-->
 
 <script type="text/javascript">
   update_right_part_menu();
   //update_messages();
   setInterval(update_messages, REFRESH_TIME); 
 </script>


